package edu.hitsz.shoot;

import edu.hitsz.aircraft.HeroAircraft;
import edu.hitsz.application.Game;

public class ShootThread extends Thread{
    private HeroAircraft heroAircraft = HeroAircraft.getHeroAircraft();
    private int shoot_type = 0;

    public ShootThread(int _shoot_type)
    {
        shoot_type = _shoot_type;
    }

    @Override
    public void run(){
        Game.if_shoot = 0;
        try {
            Thread.sleep(2);
            heroAircraft.shoot_type = shoot_type;
            Game.if_shoot = 1;
            for(int i = 0; i < 5000; i++)
            {
                if(Game.if_shoot == 0)
                    break;
                Thread.sleep(1);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        heroAircraft.shoot_type = 0;
    }
}
